package com.matt.foundation.vo.evaluate.Web;

import com.matt.foundation.constant.CourseConstant;
import lombok.Data;

import java.util.Date;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2018/1/8
 * *******************************
 */
@Data
public class WebCompletedCourseListVo {
    private String id;
    private String title;
    private Integer week;
    private String typeName;
    private Integer courseType;
    private Long created;

    public static WebCompletedCourseListVo of(Object[] object) {
        Integer courseType = object[4] == null ? 0 : Integer.valueOf(object[4].toString());
        WebCompletedCourseListVo vo = new WebCompletedCourseListVo();
        vo.setId(object[0] == null ? "" : object[0].toString());
        vo.setTitle(object[1] == null ? "" : object[1].toString());
        vo.setCreated(object[3] == null ? 0L : ((Date)object[3]).getTime());
        if (courseType == CourseConstant.CourseType.SAT.codeOf())
            vo.setWeek(object[2] == null ? 0 : Integer.valueOf(object[2].toString()));
        vo.setTypeName(object[2] == null ? "" : object[2].toString());
        vo.setCourseType(courseType);
        return vo;
    }
}
